/**
 * 
 */
package com.ybxx.core.log;

import java.lang.reflect.Method;
import java.util.Date;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;//ProceedingJoinPoint;

import com.ybxx.core.util.UUIDGenerator;


/**
 * <p>Title:</p>
 * <p>Description: </p>
 * <P>Copyright: Copyright (c) 2010-2015</P>
 * <P>Company: XA.Co.LTD</P>
 * @author:Tom.Y
 * @version 1.0
 */
public class LogAspect {
//	@Resource
//	private LogService logService;
//	private Log logger = LogFactory.getLog(LogAspect.class);
//
//	public void doSystemLog(JoinPoint point) throws Throwable{
//		String methodName = point.getSignature().getName();
//		if (StringUtils.isNotEmpty(methodName)){
//			if ((!methodName.startsWith("set")) && (!methodName.startsWith("get"))){
//				Class targetClass = point.getTarget().getClass();
//				Method method = targetClass.getMethod(methodName, new Class[0]);
//				if (method != null){
//					boolean hasAnnotation = method.isAnnotationPresent(Action.class);
//					if (hasAnnotation) {
//						Action annotation = (Action)method.getAnnotation(Action.class);
//
//						String methodDescp = annotation.description();
//						if (this.logger.isDebugEnabled()) {
//							this.logger.debug("Action method:" + method.getName() + " Description:" + methodDescp);
//						}
//						Admin admin = CurrentUserInfo.getUser();
//						if (admin != null) {
//							try {
//								com.xaltd.system.model.Log sysLog = new com.xaltd.system.model.Log();
//								sysLog.setLid(UUIDGenerator.getUUID());
//								sysLog.setLdate(new Date());
//								sysLog.setLname(admin.getLname());
//								sysLog.setName(admin.getName());
//								sysLog.setMethod(methodDescp);
//								sysLog.setType(annotation.type());
//
//								this.logService.save(sysLog);
//							} catch (Exception ex) {
//								this.logger.error(ex.getMessage());
//							}
//						}
//					}
//				}
//			}
//		}
//	}
}

